﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Threading;

namespace PuzzleCoop
{
    class LoadScreen : GameScreen
    {
        GameScreen targetGameScreen; //gameScreen que será carregada
        Thread thread;

        public LoadScreen(GameScreen targetGameScreen)
            : base()
        {
            this.targetGameScreen = targetGameScreen;
            thread = new Thread(new ThreadStart(targetGameScreen.LoadContent));
            thread.Start();
        }

        public override void Update(GameTime gameTime)
        {
            if (!thread.IsAlive) GameScreenManager.Pop();
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.GraphicsDevice.Clear(Color.Gold);
            spriteBatch.DrawString(PuzzleCoop.Font, "LOADING...", new Vector2(400, 400), Color.Black);
        }
    }
}
